#include <stdio.h>
#include <stdlib.h>


#include "list.h"

int main(void)
{
	list *l;
	l = list_create();
	datatype arr[] = {12,23,34,45,56,11,8,4,3,10};
	int i = 0,err = 0;
	for(i = 0;i<sizeof(arr)/sizeof(*arr);i++)
	{
	#if 0
		err = list_insert_at(l,0,arr+i);
		if (err != 0)
		{
			if(err == -1)
			{
				fprintf(stderr,"Enter i is error.\n");
			}
			else if(err == -2)
			{
				fprintf(stderr,"new_node malloc error.\n ");
			}
			else
			{
				fprintf(stderr,"Error!");
			}
			exit(1);	
		}
	#endif
		err = list_order_insert(l,arr+i);
		if (err != 0)
		{
			if (err == -2)
			{
				fprintf(stderr,"new_node malloc error.\n");
			}
			else
			{
				fprintf(stderr,"Error!\n");
			}
			exit(1);
		}
	}
	list_display(l);
#if 0
	datatype temp_value = 12;
	list_delete(l,&temp_value);
#endif
	datatype value;
	list_delete_at(l,2,&value);

	list_display(l);
	printf("delete value:%d\n",value);
	list_destroy(l);
	return 0;
}
